import igraph as ig
import matplotlib.pyplot as plt

"""
https://zhuanlan.zhihu.com/p/426397948
根据该教程的一些测试
"""
is_plot = True

# 生成一颗二叉树
g = ig.Graph.Tree(127, 2)

if is_plot:
    # 绘出二叉树
    fig, ax = plt.subplots(figsize=(5, 5))
    ig.plot(
        g,
        target=ax,
        layout="kk",  # print nodes in a circular layout
        vertex_size=0.1,
        vertex_frame_width=4.0,
        vertex_frame_color="white",
        vertex_label_size=7.0)
    plt.show()

# 查看是否由连边
# print(g.get_eid(2, 3))
